package cn.wolfcode.trip.admin.controller;

import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Copyright: Copyright (c) 2019 Super520
 * 描述：用户积分榜控制器
 *
 * @package: cn.wolfcode.trip.admin.controller
 * @author: Patch
 * @date: 2019/5/30 15:59
 * 总结:
 */
@Controller
@RequestMapping("integralTop")
public class IntegralTopController {
    @Autowired
    private IUserService userService;

    // 1.思路通过查询用户积分排序
    @RequestMapping("list")
    public String list(Model model, @ModelAttribute("qo") QueryObject qo) {
        // 设置每页条数
        qo.setPageSize(20);
        // 设置排序
        qo.setOrderBy("grade desc");
        model.addAttribute("pageInfo", userService.listGradeTop(qo));
        return "integral/leaderboard/list";
    }
}
